#if !defined(__HTTP_REQUEST_H)
#    define __HTTP_REQUEST_H

#    include <httpBasic.h>
#    include <json/json.h>
namespace http {
    class HttpParser;
    class HttpRequest {
    private:
        friend class HttpParser;
        StringMap data_map;  //存放请求参数的键值对 key1=val1&key2=val2...

    public:
        StringMap   http;
        std::string body;
        std::string fileName;  //存放文件名

        HttpRequest(){};
        ~HttpRequest(){};
        std::string operator[](std::string key) {
            auto it = http.find(key);
            return it != http.end() ? it->second : "";
        }

        StringMap   &getDataMap();
        std::string &getFileName() { return fileName; };
        std::string &getData() { return body; }

        bool isJson();
    };

}  // namespace http

#endif  // __HTTP_REQUEST_H
